#!/bin/bash

SPEC_DVD="$1"

if test -z "$SPEC_DVD"
then
    echo "usage: $0 <CPU2006 dir>" >&2
    exit 1
fi

PATCHDIR="$(dirname $(realpath $0))/spec2006-patches"

cd "$SPEC_DVD"

cd tools
tar xvf tools_src.tar.bz2
cd ..

for patch in "$PATCHDIR"/*.patch
do
    patch -p0 -i "$patch"
done

./install.sh

cd "$PATCHDIR/.."
./install_cpu2006 "$SPEC_DVD"
    
